﻿using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Vaffanculo.Migration.ImplementsSchema.Excel;
using Vaffanculo.Migration.ImplementsSchema;
using Vaffanculo.Migration.SchemaMigration;
namespace Vaffanculo.Migration.Test
{
    [TestClass]
    public class ExcelMigration
    {
        /*[TestMethod]
        public void LoadXml()
        {
            var xmlMigration = new XmlMigration();
            xmlMigration.PathXml= @"I:\Vaffanculo\migracionCNDC.xml";
            xmlMigration.ReadMapXml();
            Assert.AreEqual(1, xmlMigration.FilesSourceMigration.Count);
            Assert.AreEqual(2,xmlMigration.FilesSourceMigration[0].Dimentions.Count);
            Assert.AreEqual(4, xmlMigration.FilesSourceMigration[0].Facts.Count);

            Assert.AreEqual(1, xmlMigration.FilesSourceMigration.Count);
            Assert.AreEqual("daily", xmlMigration.FilesSourceMigration[0].Cycle);
            Assert.AreEqual(@"I:\Vaffanculo\ExcelPruebas\", xmlMigration.FilesSourceMigration[0].PathFile);
            Assert.AreEqual("dathid_DDMMYY", xmlMigration.FilesSourceMigration[0].FilePattern);
            Assert.AreEqual("07-04-2012", xmlMigration.FilesSourceMigration[0].DateTimeStart.ToString("dd-MM-yyyy"));
            Assert.AreEqual("07-04-2012", xmlMigration.FilesSourceMigration[0].DateTimeEnd.ToString("dd-MM-yyyy"));
            
        }*/

        /*[TestMethod]
        public void TestConection()
        {
            InitMigration initMigration = new InitMigration();
            initMigration.TestConection();
        }
        */
       /* [TestMethod]
        public void ReadDimention()
        {
            InitMigration initMigration = new InitMigration(@"i:\Vaffanculo\migracionCNDC.xml");
            Assert.AreEqual(1, initMigration.SchemaXmlMigration.FilesSourceMigration.Count);
            Assert.AreEqual(2, initMigration.SchemaXmlMigration.FilesSourceMigration[0].Dimentions.Count);
            //Assert.AreEqual(6, initMigration.SchemaXmlMigration.FilesSourceMigration[0].Dimentions[0].Replace.Count);
            Assert.AreEqual(4, initMigration.SchemaXmlMigration.FilesSourceMigration[0].Facts.Count);


            Assert.AreEqual(1, initMigration.ReadFileExcel.ListsDimentions.Count);
            Assert.AreEqual(35, initMigration.ReadFileExcel.ListsDimentions[0].ListCellExcel.Count);
            Assert.AreEqual(4, initMigration.ReadFileExcel.ListsFacts.Count);
            Assert.AreEqual(3,
                            initMigration.SequenceList(initMigration.SchemaXmlMigration.FilesSourceMigration[0].Cycle,
                                                       initMigration.SchemaXmlMigration.FilesSourceMigration[0].
                                                           DateTimeStart,
                                                       initMigration.SchemaXmlMigration.FilesSourceMigration[0].
                                                           DateTimeEnd).Count);

           
            
            //readFileExcel.ReadDimention(initMigration.SchemaXmlMigration.FilesSourceMigration);
        }

        /*[TestMethod]
        public void ReadDimention1()
        {
            InitMigration initMigration = new InitMigration(@"i:\Vaffanculo\migracionCNDC 1.xml");
            Assert.AreEqual(1, initMigration.SchemaXmlMigration.FilesSourceMigration.Count);
            Assert.AreEqual(3, initMigration.SchemaXmlMigration.FilesSourceMigration[0].Dimentions.Count);
            Assert.AreEqual(1, initMigration.SchemaXmlMigration.FilesSourceMigration[0].Facts.Count);

            

            Assert.AreEqual(1, initMigration.ReadFileExcel.ListsDimentions.Count);
            Assert.AreEqual(35, initMigration.ReadFileExcel.ListsDimentions[0].ListCellExcel.Count);
            Assert.AreEqual(4, initMigration.ReadFileExcel.ListsFacts.Count);
            Assert.AreEqual(3,
                            initMigration.SequenceList(initMigration.SchemaXmlMigration.FilesSourceMigration[0].Cycle,
                                                       initMigration.SchemaXmlMigration.FilesSourceMigration[0].
                                                           DateTimeStart,
                                                       initMigration.SchemaXmlMigration.FilesSourceMigration[0].
                                                           DateTimeEnd).Count);

        }*/


       /* [TestMethod]
        public void ReadDimention()
        {
            InitMigration initMigration = new InitMigration(@"i:\Vaffanculo\migracionCNDC 2.xml");
            Assert.AreEqual(1, initMigration.SchemaXmlMigration.FilesSourceMigration.Count);
            Assert.AreEqual(2, initMigration.SchemaXmlMigration.FilesSourceMigration[0].Dimentions.Count);
            Assert.AreEqual(1, initMigration.SchemaXmlMigration.FilesSourceMigration[0].Facts.Count);

        }*/


        [TestMethod]
        public void ReadDimention()
        {
            InitMigration initMigration = new InitMigration(@"i:\Vaffanculo\migracionCNDC 3.xml");
            Assert.AreEqual(1, initMigration.SchemaXmlMigration.FilesSourceMigration.Count);
            Assert.AreEqual(2, initMigration.SchemaXmlMigration.FilesSourceMigration[0].Dimentions.Count);
            Assert.AreEqual(1, initMigration.SchemaXmlMigration.FilesSourceMigration[0].Facts.Count);

        }
    }
}

